package url;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

public class GetCode {

	public static void main(String[] args) throws IOException {
		URL url=new URL("http://www.9bugs.com/"); //要获取的url
		URLConnection urlconn=url.openConnection(); //取得链接,返回URLConnection
		InputStream is=urlconn.getInputStream();//获得输入流,返回InputStream
		byte[] b=new byte[100];
		int line;
		while((line=is.read(b))>0)
		{
			System.out.println(new String(b, 0, line));
		}
	}

}
